home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- #
- # Update DES 1.x and IRIX 6.2 OutBox pages to work with 6.3
- # 1. add toolbars to unmodified OutBox pages for machine and users
- # 2. add links for index.shtml for SSI pages
- #
-
- # add toolbar to page if it can be identified as an OutBox machine page
-
- indexFile=/var/www/htdocs/index.html
- sIndexFile=/var/www/htdocs/index.shtml
- tmpFile=/var/tmp/index.html.$$
-
- if [ -w $indexFile ] ; then
- if grep '/cgi-bin/machine-cgi' $indexFile >/dev/null 2>&1 ; then
- :
- elif grep '/var/www/htdocs/userList' $indexFile >/dev/null 2>&1 ; then
- # set up .shtml link for new webserver config
- if [ ! -f $sIndexFile ] ; then
- ln -sf index.html $sIndexFile
- fi
- # add toolbar to existing OutBox machine page
- sed -e "s:^<img src=/images/poweredsgi.gif><p><br>$:\
- <!--DO NOT REMOVE--><!--#exec cgi=\"/cgi-bin/machine-cgi\" -->\
- :" $indexFile > $tmpFile
- cmp -s $indexFile $tmpFile >/dev/null 2>&1
- if [ $? = 1 ] ; then
- cp -f $tmpFile $indexFile
- fi
- fi
- fi
-
- # add toolbar to page if it can be identified as an OutBox user page
-
- for file in /var/www/htdocs/*
- do
- indexFile=$file/index.html
- sIndexFile=$file/index.shtml
- if [ -w $indexFile ]
- then
- user=`echo $file | sed -e "s:/var/www/htdocs/::" 2>/dev/null`
- if grep '/cgi-bin/outbox-cgi' $indexFile >/dev/null 2>&1
- then
- :
- elif grep '/cgi-bin/wrap' $indexFile >/dev/null 2>&1
- then
- # add link for SSI file index.shtml
- uid=`/usr/bin/id -un $user 2>/dev/null`
- gid=`/usr/bin/id -gn $user 2>/dev/null`
- # set up .shtml link for new webserver config
- if [ ! -f $sIndexFile ]
- then
- ln -sf index.html $sIndexFile
- chown -hf $uid $sIndexFile
- chgrp -hf $gid $sIndexFile
- fi
- # add toolbar to top of page
- sed -e "s:\(<[bB][oO][dD][yY].*>\):\1\
- <!--DO NOT REMOVE--><!--#exec cmd=\"/var/www/cgi-bin/outbox-cgi /$user\" -->\
- :" $indexFile > $tmpFile 2>/dev/null
- cmp -s $indexFile $tmpFile >/dev/null 2>&1
- if [ $? = 1 ]
- then
- cp -f $tmpFile $indexFile
- chown -hf $uid $indexFile
- chgrp -hf $gid $indexFile
- fi
- fi
- fi
- done
-
- rm -f $tmpFile
-
-